package NGeter;

use strict;
use LWP::UserAgent;
use HTTP::Headers;
use vars qw($VERSION @ISA @EXPORT_OK);

# $Date: 2007/01/30 16:26 $
$VERSION = 0.1;

require Exporter;
*import = \&Exporter::import;
@EXPORT_OK = qw(geturl printurl);

#获取指定URL的内容
sub geturl {
	my $ua = LWP::UserAgent->new;
	$ua->agent("nGeter/0.1");
	my $req = HTTP::Request->new(GET => @_);
	my $res = $ua->request($req);
	my $u = "";
	if($res->is_success){
		$u = $res->content;
	}else{
		print $res->status_line, "\n";
	}

	return $u;
}

sub printurl {
	print &geturl(@_[0]), "\n";
}

1;
